The AHI-Handler
is an I/O mechanism that is used to play and record
sounds. The AHI-Handler
is normally mounted as AUDIO:
at
startup time, or later by double-clicking on its icon or by giving the
following command in a Shell window: mount AUDIO: RET.
The DOSDriver entry is:
Handler = L:AHI-Handler Stacksize = 4096 Priority = 5 GlobVec = -1
When the device is mounted, you can read from the device to record and write to it to play. Options can be given like this:
"AUDIO:PRIORITY=1 VOLUME=50"
All slashes (`/') in the name will be translated to spaces. Thus, if you use slashes instead of spaces, you don't have to use quotes around the name:
AUDIO:PRIORITY/1/VOLUME/50
The full template for reading is:
B=BITS/K/N,C=CHANNELS/K/N,F=FREQUENCY/K/N,T=TYPE/K,L=LENGTH/K/N, S=SECONDS/K/N,BUF=BUFFER/K/N,UNIT/K/N
The full template for writing is:
B=BITS/K/N,C=CHANNELS/K/N,F=FREQUENCY/K/N,T=TYPE/K,V=VOLUME/K/N, P=POSITION/K/N,PRI=PRIORITY/K/N,L=LENGTH/K/N,S=SECONDS/K/N, BUF=BUFFER/K/N,UNIT/K/N
`BITS' can be one of 8, 16 or 32. `CHANNELS' can be either 1 for
mono or 2 for stereo. The `FREQUENCY' is in Hertz, `TYPE' is one
of `SIGNED', `AIFF' or `AIFC'. `VOLUME' ranges from 0
(silence) to 100 (full volume), and `POSITION' ranges from -100
(far left) via 0 (center) to 100 (far right). The `PRIORITY' can be
from -128 to 127 (unstoppable). `LENGTH' is how many bytes you
wish to read or write, and `SECONDS' is the same, but in seconds
instead of bytes. The `BUFFER' size is specified in bytes. Note that
two buffers are always used, which means that the memory usage will be two
times BUFFER. `UNIT' selects which ahi.device
unit to use.
The default options for reading are `BITS=8' `CHANNELS=1' `FREQUENCY=8000' `TYPE=SIGNED' `LENGTH=very-very-much' `BUFFER=32768' `UNIT=0'.
The default options for reading are `BITS=8' `CHANNELS=1' `FREQUENCY=8000' `TYPE=<none>' `VOLUME=100' `POSITION=0' `PRIORITY=0' `LENGTH=very-very-much' `BUFFER=32768 UNIT=0'.
If `TYPE' is not specified, the default behaviour is to identify the data stream as IFF-AIFF or IFF-AIFC. If so, the default values of `BITS', `CHANNELS', `FREQUENCY' and `LENGTH' will taken from the file. You can still override them if you wish. If the stream could not be identified, the data format is assumed to be `SIGNED'.
Both when reading and writing the sample rate will be converted on the fly to what the underlying hardware is configured to. Normally this is not a big problem when writing, but the quality when reading leaves quite a lot to wish for, since no low-pass filters are used.
Example 1:
copy Louise.AIFF AUDIO:
plays the file `Louise.AIFF'.
Example 2:
copy AUDIO:SECONDS/10/TYPE/AIFC/B/16/F/44100/C/2 sample.AIFC
records 10 seconds of audio and stores it in the file `sample.AIFC' as uncompressed IFF-AIFC, 16 bit stereo at 44.1 kHz.
Go to the first, previous, next, last section, table of contents.